import sys
from PyQt5.QtWidgets import QWidget,QApplication
import ui_test
import threading

def thread_test():
    print("测试线程id:",threading.current_thread().ident)

class InitForm(QWidget):
    
    def __init__(self):
        super().__init__()
        self.ui = ui_test.Ui_Form()
        self.ui.setupUi(self)
        self.setWindowTitle("测试")
        print("主线程id:",threading.current_thread().ident)

        threading.Thread(target=thread_test, daemon=True).start()
        threading.Thread(target=thread_test, daemon=True).start()
    def closeEvent(self, event):
        print("窗体关闭")

if __name__ == "__main__":

    app = QApplication(sys.argv)
    w1 = InitForm()
    w1.show()
    sys.exit(app.exec_())